<?php
//导航栏输出?n=**&p=**
//获取GET信息
$n=$_GET["n"];
$p=$_GET["p"];

$servername = "localhost";
$username = "root";
$password = "root";
$dbname = "mydb3";
 
// 创建连接
$conn = mysqli_connect($servername, $username, $password, $dbname);
// 检测连接
if (!$conn) {
    die("Connection failed: " . mysqli_connect_error());
}
//插入user表的sql语句
$sql = "INSERT INTO `user` (`id`, `name`, `password`) VALUES (NULL, '$n', '$p');";
 
if (mysqli_query($conn, $sql)) {
    echo "新记录插入成功";
} else {
    echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
 
mysqli_close($conn);
?>